package baseline;

import java.io.*;

public class TestFile {
  String testFileName_;

  public TestFile(String fileName) {
    testFileName_ = fileName;
  }

  public void process(TrainingFile tf) throws IOException {
    FileWriter fw = new FileWriter(testFileName_ + ".nnp");
    BufferedWriter out = new BufferedWriter(fw);

    FileReader fr = null;
    fr = new FileReader(new File(testFileName_));
    BufferedReader in = new BufferedReader(fr);

    String word;
    while (true) {
      word = in.readLine();

      if (word == null) {
        break;
      }

      String outstr = tf.getBestTag(word) + " " + word + "\n";
      out.write(outstr);
    }

    out.close();
    fw.close();

    in.close();
    fr.close();
  }

  public String getTestFileName() {
    return testFileName_;
  }
}
